package com.example.demo.mapper;




import com.example.demo.pojo.Administrator;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanglup
 * @create 2020-12-05 19:12
 */
@Mapper
public interface AdministratorMapper {
    /**查询管理员列表*/
    @Select("select * from administrator;")
    List<Administrator> Administratorlist();
    /**管理员列表数量*/
    @Select("select count(*) from administrator;")
    Integer Administratorlistnumber();

    /**添加数据*/
    @Insert("insert into administrator(username,password,email) values (#{username},#{password},#{email});")
    void Administratoraddtijiao(String username, String password, String email);

    /**修改1查看对应信息*/
    @Select("select * from administrator where adminid=#{adminid}")
    Administrator Administratorupdate(Integer adminid);
    /**修改2插入信息*/
    @Insert("update administrator set adminid=#{adminid2},username=#{username},password=#{password},email=#{email} where adminid=#{adminid1};")
    void Administratorupdatetijiao(Integer adminid1, Integer adminid2, String username, String password, String email);

    /**删除*/
    @Delete("delete from administrator where adminid=#{adminid};")
    void Administratdelete(Integer adminid);

    /**管理员登陆*/
    @Select("select username,password from administrator where username=#{username} and password=#{password};")
    Administrator logincheck(String username, String password);
}
